/**
 * filename: UserInfo.java
 * author: luruifeng
 * date: 2016年3月1日
 * http: <a href='http://www.anzeinfo.com'>www.anzeinfo.com</a>
 * Copyright (c) 2016 Anze, Inc. All rights reserved.
 */
package com.anze.abd.persistence.domain;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.anze.base.persistence.domain.User;

/**
 * 用户信息
 * @author luruifeng 2016年3月1日
 * @version 2.4
 * @since 2.4 2016年3月1日
 */
@Table(name = "USER_INFO")
@Entity
public class UserInfo implements Serializable {

	private static final long serialVersionUID = 8461099083202022219L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "ID")
	private Long id;
	
	/**
	 * 真实姓名
	 */
	@Column(name = "NAME")
	private String name;
	
	/**
	 * 年龄
	 */
	@Column(name = "AGE")
	private String age;
	
	/**
	 * 电子邮箱
	 */
	@Column(name = "EMAIL")
	private String email;
	
	@Column(name = "USER_ID")
	private Long userid;
	
	/**
	 * 用户
	 */
	@ManyToOne()
	@JoinColumn(name = "USER_ID", unique = true, insertable = false, updatable = false)
	private User user;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	/**
	 * @return 真实姓名
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name 真实姓名
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return 年龄
	 */
	public String getAge() {
		return age;
	}

	/**
	 * @param age 年龄
	 */
	public void setAge(String age) {
		this.age = age;
	}

	/**
	 * @return 电子邮箱
	 */
	public String getEmail() {
		return email;
	}

	/**
	 * @param email 电子邮箱
	 */
	public void setEmail(String email) {
		this.email = email;
	}

	/**
	 * @return 
	 */
	public Long getUserid() {
		return userid;
	}

	/**
	 * @param userid 
	 */
	public void setUserid(Long userid) {
		this.userid = userid;
	}

	/**
	 * @return 用户
	 */
	public User getUser() {
		return user;
	}

	/**
	 * @param user 用户
	 */
	public void setUser(User user) {
		this.user = user;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		UserInfo other = (UserInfo) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "UserInfo [id=" + id + ", name=" + name + ", age=" + age + ", email=" + email
				+ ", user=" + user + "]";
	}

}
